package com.jkt.rms.dataservice.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

import com.jkt.rms.business.Project;
import com.jkt.rms.commons.utils.RMSException;
import com.jkt.rms.dataservice.AbstractDataService;
import com.jkt.rms.dataservice.ProjectDataService;

public class ProjectDataServiceImpl extends AbstractDataService<Project> implements
		ProjectDataService {

	@Override
	public Project saveProject(Project project) {
		return save(project);
	}

	@Override
	protected Class<Project> getReferenceClass() {
		return Project.class;
	}
	
	public List<Project> findByCriteria(DetachedCriteria crit){
		return super.findByCriteria(crit);
	}

	public Project findProjectById(int projectId){
		return (Project)super.find(projectId);
	}
	public void updateProject(Project project) throws RMSException{
		super.saveOrUpdate(project);
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Project> findAllActiveProject() {
		return getSession().createQuery("from Project p where p.status = 'Y'").list();
		
		
	}
}
